import http from '@/utils/service';

const API = {
  orderComplaint: '/orderComplaints/orderComplaint',
  getComplaint: '/orderComplaints/getComplaint?orderId=',
  complaint: '/orderComplaints/complaint',
};

export interface OrderComplaints {
  userId: number;
  restaurantId: number;
  orderId: number;
  complaintContent: string;
}

export interface GetComplaint {
  id: number;
  complaintId: number;
  senderId: number;
  senderType: number;
  commentContent: string;
  date: string;
}
export interface Complaint {
  complaintId: number;
  senderId: number;
  senderType: number;
  commentContent: string;
}

export const OrderComplaintsAPI = (data: OrderComplaints) =>
  http.post(API.orderComplaint, { data });

export const GetComplaintAPI = (orderId: number) =>
  http.get(API.getComplaint + orderId);

export const ComplaintAPI = (data: Complaint) =>
  http.post(API.complaint, { data });
